﻿#include "mainwindow.h"
#include <QApplication>
#include <QStandardPaths>
#include <QSplashScreen>
#include <QSettings>

std::shared_ptr<spdlog::logger> logger  = spdlog::daily_logger_mt("daily_logger", "logs/daily.txt", 7, 30);


int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QFile styleFile(QCoreApplication::applicationDirPath() + "/para/dark.qss");
    if(styleFile.open(QFile::ReadOnly))
    {
        qApp->setStyleSheet(styleFile.readAll());
        styleFile.close();
    }


	QString m_para_dir = QCoreApplication::applicationDirPath() + "/para";
	QString path_ini;
	path_ini = m_para_dir + "/para.ini";
	//创建配置文件操作对象
	QSettings* m_settings_para = new QSettings(path_ini, QSettings::IniFormat);
	m_settings_para->setIniCodec("UTF-8");
	int font_size = m_settings_para->value("para/font_size", 10).toInt();
	delete m_settings_para;

	QFont main_font("Microsoft YaHei", font_size);

    a.setFont(main_font);

//    QString path   = QCoreApplication::applicationDirPath() + "/picture/background.svg";
//    QPixmap pixmap(path);
//    QSplashScreen *splash = new QSplashScreen;

//    QFont font("Microsoft YaHei",50);


//    splash->setFont(font);
//    splash->showMessage("程序启动中...", Qt::AlignCenter, Qt::white);	//显示文字、对齐方式、文字颜色
//    splash->setPixmap(pixmap);										//绑定图片
//    splash->show();                            						//显示启动画面
//    logger->flush_on(spdlog::level::info);

    MainWindow w;

    w.show();
//    splash->finish(&w);											//关闭启动界面
//    delete splash;

    return a.exec();
}
